/*
 * SocketServer.h
 *
 *  Created on: Dec 22, 2011
 *      Author: dzm
 */

#include <iostream>
#include <QHostInfo>
#include <QStringList>
#include <QTcpServer>
#include <QThread>

#include "NetworkUtil/SocketRead.h"
#include "Node.h"

#ifndef SOCKETSERVER_H_
#define SOCKETSERVER_H_

class SocketServer : public QTcpServer {

	Q_OBJECT

public:
	SocketServer();
	explicit SocketServer( int , int ,Node, QObject *parent = 0 );
	virtual ~SocketServer();

	void set(int , int , Node);
	QHostAddress getLocalIP();

protected:
	void incomingConnection(int socketDescriptor);

public slots:
	void onNewConnection();
    void processNewConnection();

private:
    int inport_ss;
	quint16 port;
	Node localnode_ss;
	int socketID;   //以后可能要加锁
	QTcpSocket *tcpSock;
	int countTime ;
};

#endif /* SOCKETSERVER_H_ */
